 

Component({
  data: {
    isPopping: false, //是否已经弹出
    animPlus: {}, //旋转动画
    animCollect: {}, //item位移,透明度
    animTranspond: {}, //item位移,透明度
    animInput: {}, //item位移,透明度

    selected: 0,
    color: "#605f5e",
    //selectedColor: "#ff5d33",
    selectedColor: "#8c9eff",
    list: [{
        text: "首页",
        pagePath: "/pages/index/index",
        iconPath: "/imgs/f1.png",
        selectedIconPath: "/imgs/f11.png",
      },
      {
        text: "订单中心",
        pagePath: "/pages/get/get",
        iconPath: "/imgs/d1.png",
        selectedIconPath: "/imgs/d11.png",
      },
      {
        text: "",
        pagePath: "/pages/kuaidi/kuaidi",
        iconPath: "/imgs/jiahao.png",

      },
      {
        pagePath: "/pages/lose/lose",
        iconPath: "/imgs/sw.png",
        selectedIconPath: "/imgs/sw1.png",
        text: "失物招领"
      },
      {
        pagePath: "/pages/my/my",
        iconPath: "/imgs/my1.png",
        selectedIconPath: "/imgs/my11.png",
        text: "我的"
      }
    ],

  },
  attached() {},
  methods: {
    // 震动
    vibrateShortTap: function () {
      wx.vibrateShort();
      //console.log("整栋")
    },
    // 跳转
    switchTab(e) {
      this.vibrateShortTap();
      const data = e.currentTarget.dataset
      console.log(data)
      const url = data.path
      if (data.index != 2) {
        wx.switchTab({
          url
        })
      } else {
        wx.navigateTo({
          url: '/pages/kuaidi/kuaidi',
        })
      }
    },

    // 动画效果
    //点击弹出
    plus: function () {
      if (this.data.isPopping) {
        //缩回动画
        this.popp();
        this.setData({
          isPopping: false
        })
      } else if (!this.data.isPopping) {
        //弹出动画
        this.takeback();
        this.setData({
          isPopping: true
        })
      }
    },

    // 跳转 发布快递 页面
    collect: function () {
      wx.navigateTo({
        url: '/pages/kuaidi/kuaidi',
      })
    },
    // 跳转 跑腿 页面
    transpond: function () {
      wx.navigateTo({
        url: '/pages/run/run',
      })
    },

    // 跳转 qita 页面
    input: function () {
      wx.navigateTo({
        url: '/pages/qita/qita',
      })
    },



    //弹出动画
    popp: function () {
      //plus顺时针旋转
      var animationPlus = wx.createAnimation({
        duration: 500,
        timingFunction: 'ease-out'
      })
      var animationcollect = wx.createAnimation({
        duration: 500,
        timingFunction: 'ease-out'
      })
      var animationTranspond = wx.createAnimation({
        duration: 500,
        timingFunction: 'ease-out'
      })
      var animationInput = wx.createAnimation({
        duration: 500,
        timingFunction: 'ease-out'
      })
      /*     animationPlus.rotateZ(220).step();
          animationcollect.translate(-100, -100).rotateZ(180).opacity(1).step();
          animationTranspond.translate(-140, 0).rotateZ(180).opacity(1).step();
          animationInput.translate(-100, 100).rotateZ(180).opacity(1).step(); */

      animationPlus.rotateZ(223).step();
      animationcollect.translate(-60, -70).rotateZ(360).opacity(1).step();
      animationTranspond.translate(0, -90).rotateZ(360).opacity(1).step();
      animationInput.translate(60, -70).rotateZ(360).opacity(1).step();


      this.setData({
        animPlus: animationPlus.export(),
        animCollect: animationcollect.export(),
        animTranspond: animationTranspond.export(),
        animInput: animationInput.export(),
      })
    },

    //收回动画
    takeback: function () {
      //plus逆时针旋转
      var animationPlus = wx.createAnimation({
        duration: 500,
        timingFunction: 'ease-out'
      })
      var animationcollect = wx.createAnimation({
        duration: 500,
        timingFunction: 'ease-out'
      })
      var animationTranspond = wx.createAnimation({
        duration: 500,
        timingFunction: 'ease-out'
      })
      var animationInput = wx.createAnimation({
        duration: 500,
        timingFunction: 'ease-out'
      })
      animationPlus.rotateZ(0).step();
      animationcollect.translate(0, 0).rotateZ(0).opacity(0).step();
      animationTranspond.translate(0, 0).rotateZ(0).opacity(0).step();
      animationInput.translate(0, 0).rotateZ(0).opacity(0).step();
      this.setData({
        animPlus: animationPlus.export(),
        animCollect: animationcollect.export(),
        animTranspond: animationTranspond.export(),
        animInput: animationInput.export(),
      })
    },





  },


})